{varType ApiGen\Index\Index $index}
{varType ApiGen\Renderer\Latte\Template\ConfigParameters $config}
{varType ApiGen\Renderer\Latte\Template\LayoutParameters $layout}

{define menuGroup, ApiGen\Index\NamespaceIndex $namespace, int $level = 0}
	<ul>
		{foreach $namespace->children as $child}
			{var bool $isActive = $layout->activeNamespace && str_starts_with("{$layout->activeNamespace->name->fullLower}\\", "{$child->name->fullLower}\\")}
			{var bool $isCollapsed = $level > 0 && !$isActive}
			{skipIf !$child->primary && !$isActive}
			{skipIf !namespacePageExists($child)}
			<li n:class="menuGroup-item, $isActive ? active">
				<a href="{namespaceUrl($child)}" n:class="$child->deprecated ? deprecated">{$child->name->short ?: 'none'}</a>
				{if !$isCollapsed && $child->children && $child->name->short !== ''}
					{include this, namespace: $child, level: $level + 1}
				{/if}
			</li>
		{/foreach}
	</ul>
{/define}
